<template>
	<view>
		<uni-nav-bar left-icon="arrowthinleft" title="商家商品" :border="false" :fixed="true" bg="bg-fff" color="#333" @clickLeft="goBack()"></uni-nav-bar>
	<!-- 	<view class="padding-24">
			<view class="bg-fff flex align-center justify-center h45">
				<text class="fs-28 color-zhuse">全部</text>
				<image src="../../static/img/down_o.png" style="width: 30rpx;height: 30rpx;"></image>
			</view>
		</view> -->
		<view class="clearfix   padding-x-10 margin-top-16">
			<!-- 商家列表 -->
			<view v-for="(item,index) in list" :key='index'  class="w50 fl padding-x-10 margin-bottom-30  bg-fff">
				<view class="goods_item">
					<image class="goods_img" :src="item.img" mode="aspectFit"></image>
					<view class="margin-top-10 padding-x-20">
						<view class="fs-28 color-333 text-cut">{{item.name}}</view>
						<view class="fs-32 color-zhuse  padding-y-20">¥{{item.price}}</view>
					</view>
				</view>
			</view>
			<!-- 商家列表 end -->
		</view>
		
		<view class="nomore" :class="loadStatus" v-if="list.length"></view>
		<empty position="static" v-if="list.length < 1"></empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hasMore: true,
				loadStatus: '',
				list: [],
				q:{
					shop_id:'',
					page:1,
				}
			}
		},
		onLoad(opt) {
			this.q.shop_id = opt.shop_id;
			this.getList()
		},
		onReachBottom() {
			if(this.hasMore){
				this.q.page += 1;
				this.getList();
			}
		},
		methods:{
			getList(){
				this.isLoading = true;
				this.$api.shop_goods(this.q).then(res=>{
					if(res.code == 1){
						this.isLoading = false;
						this.list = [...this.list, ...res.data.data];
						if (res.data.data.length != 0) {
							this.hasMore = true;
							this.loadStatus = '';
						} else {
							this.hasMore = false;
							this.loadStatus = 'over';
						}
					}
				})
			},
		}
	}
</script>

<style>
	page{background: #F7F7F7;}
</style>
